<?php
if (isset($InputData['list_type'])) {
    //如果为作品待审核列表 加入审核按钮
    if ($InputData['list_type'] == work_m::ListTopicWait && $_SESSION['user_level'] >= 90) {
        $works_list_btn_show = 1;
    } //如果为作品选择加入本领列表
    elseif ($InputData['list_type'] == work_m::ListUserWorksRelease
        && isset($InputData['user_field_manage']) && $InputData['user_field_manage'] == 3
        && isset($InputData['add_type']) && ($InputData['add_type'] == 2 || $InputData['add_type'] == 12)
    ) {
        if (isset($_SESSION['user_field_work_list'])) {
            $user_field_work_list = array();
            $_user_field_work_list = explode(',', $_SESSION['user_field_work_list']);
            foreach ($_user_field_work_list as $value) {
                $user_field_work_list[$value] = 1;
            }
        }
        $works_list_btn_show = 2;
    } //如果为作品在本领中排序
    elseif ($InputData['list_type'] == work_m::ListUserField) {
        $works_list_btn_show = 3;
    } elseif ($InputData['list_type'] == work_m::ListUserForTopic) {
        $works_list_btn_show = 4;
        $i = 0;
        echo '<span id="msg_topic_id" style="display:none">' . $InputData['topic_id'] . '</span>';
    } else {
        $works_list_btn_show = 0;
    }
} else {
    $works_list_btn_show = 0;
}
if (isset($workList) && count($workList) > 0) {
    if ($InputData['list_type'] == work_m::ListTopicOK ||
        $InputData['list_type'] == work_m::ListTopicOKHot ||
        $InputData['list_type'] == work_m::ListTopicOKRecommend
    ) {
        //如果是从专题下的作品列表，增加连接标记，当进入作品并推荐 则另外累计推荐的次数
        if (isset($topicMsg)) { //当前已查询过专题的信息，从专题页面进来的话
            $workLinkEx = '&from_topic=' . $topicMsg->Id;
        } else {
            $workLinkEx = '';
        }
    } else {
        $workLinkEx = '';
    }
    foreach ($workList as $workMsg) {
        $workImg = make_img_name::make_img_mini_name(explode(';', $workMsg->Picture, 2)[0]);
        if (count($workImg) > 0) {
            $isRecommend = $myWork->work_recommend_check($workMsg->Id);
            if ($isRecommend === true) $recommendIconEx = ''; else $recommendIconEx = '-o';
            $isCommend = $myWork->work_comment_check($workMsg->Id);
            if ($isCommend === true) $commendIconEx = ''; else $commendIconEx = '-o';
            ?>
            <li data-id="<?= $workMsg->Id ?>" style="padding: 10px">
                <div class="am-thumbnail" style="margin-bottom:0px">
                    <h3 style="margin-top: 5px;margin-bottom: 5px;padding-left: 15px;">
                        <span class="app-tittle-color"><?= $workMsg->Name ?></span><br/><a
                                class="web-main-color"><?= $workMsg->UserName ?></a>
                    </h3>
                    <a onclick="act_content(this)"
                       data-forward="controller=work_show&work_id=<?php echo $workMsg->Id . $workLinkEx ?>">
                        <div class="app-img-flex"
                             style="background-image:url(<?= $CfgPara->httproot ?>/works_pic/<?= $workImg ?>);">
                        </div>
                    </a>
                    <div class="am-thumbnail-caption" style="text-align:center;padding:8px 0px">
                        <div class="am-g am-text-xs">
                            <div style="padding: 0 5px;" class="am-u-sm-4 app-comment-color"><i
                                        class="am-icon am-icon-heart<?= $recommendIconEx ?> am-icon-fw"></i><?= formatDataSize($workMsg->UpCount) ?>
                            </div>
                            <div style="padding: 0 5px;" class="am-u-sm-4 app-comment-color"><i
                                        class="am-icon am-icon-comment<?= $commendIconEx ?> am-icon-fw"></i><?= formatDataSize($workMsg->CommentCount) ?>
                            </div>
                            <div style="padding: 0 5px;" class="am-u-sm-4 app-comment-color"><i
                                        class="am-icon am-icon-eye am-icon-fw"></i><?= formatDataSize($workMsg->ViewCount) ?>
                            </div>
                        </div>
                    </div>
                </div>
            </li>
        <?php } //if(count($workImg) > 0)结束
    }//foreach ($workList as $workMsg) 结束
} //if(isset($workList))结束
else //没有内容
{
    if (!isset($InputData['page_change']) || isset($InputData['search_text']) || $isTablet === TRUE)
        require("{$CfgPara->root}/view/warning_nocontent.app.v.php");
}
?>